dcfandomcom_pt_br-20200215-history
Módulo:ComicsInfobox/Citizenship
local valid = { "Abysmiana" = "Abysmianos", "Afegã" = "Afegãos", "Africana" = "Africanos", "Americana" = "Americanos", "Amerikana" = "Amerikanos", "Amazona" = "Amazonas", "Angolana" = "Angolanos", "Apokoliptiana" = "Apokoliptianos", "Argentina" = "Argentinos", "Armênio" = "Armênios", "Asgardiana" = "Asgardianos", "Atlante" = "Atlantes", "Attilana" = "Attilanos", "Australiana" = "Australianos", "Austríaca" = "Austríacos", "Azaniana" = "Azanianos", "Aztek" = "Azteks", "Balkana" = "Balkanos", "Belarusian" = "Belarusians", "Belga" = "Belgas", "Bhutranian" = "Bhutranians", "Bialyan" = "Bialyans", "Borgonian" = "Borgonians", "Bosnian" = "Bosnians", "Brasileira" = "Brasileiros", "Britânica" = "Britânicos", "Cambodian" = "Cambodians", "Canaanite" = "Canaanitas", "Canadense" = "Canadenses", "Carib" = "Caribs", "Chinesa" = "Chineses", "Colombian" = "Colombians", "Congolese" = "Congolese", "Cooperative" = "Cooperative", Verdean" = "Costa Verdeans", "Croata" = "Croatas", "Cubana" = "Cubanos", "Czechoslovakian" = "Czechoslovakians", "Danish" = "Danes", "Delanzan" = "Delanzans", "Delvadian" = "Delvadians", "Dominican" = "Dominicans", "Holandesa" = "Holandeses", "Egípcia" = "Egípcios", "Inglesa" = "Ingleses", "Eterna" = "Eternos", "Etíope" = "Etíopes", "Européia" = "Europeus", "Feitherana" = "Feitheranos", "Filipina" = "Filipinos", "Finnish" = "Fins", "French" = "French", "Gamorran" = "Gamorrans", "Gardevian" = "Gardevians", "Genesisian" = "Genesisians", "Georgian" = "Georgians", "Alemã" = "Alemãos", "Ghanaian" = "Ghanaians", "Ghudazan" = "Ghudazans", City Citizen" = "Gorilla City Citizens", "Greek" = "Greeks", "Guatemalan" = "Guatemalans", "Haitian" = "Haitians", "Hasaraguan" = "Hasaraguans", "Hawaiian" = "Hawaiians", "Hellion" = "Hellions", "Húngara" = "Húngaros", "Hun" = "Huns", "Icelandic" = "Icelanders", "Ilandian" = "Ilandians", "Indian" = "Indians", "Indonesian" = "Indonesians", "Inniversian" = "Inniversians", "Iraniana" = "Iranianas", "Iraqi" = "Iraqis", "Irish" = "Irish", "Israeli" = "Israelis", "Israelite" = "Israelites", "Italian" = "Italians", "Jamaican" = "Jamaicans", "Japanese" = "Japanese", "Jarhanpurian" = "Jarhanpurians", "Kandorian" = "Kandorians", "Karlovnan" = "Karlovnans", "Kaznian" = "Kaznians", "Kenyan" = "Kenyans", "Kahndaqi" = "Kahndaqis", "Korean" = "Koreans", "Koran" = "Korans", "Kravian" = "Kravians", "K'un-L'unan" = "K'un-L'unans", "Laotian" = "Laotians", "Latkovian" = "Latkovians", "Latverian" = "Latverians", "Libyan" = "Libyans", "Lithuanian" = "Lithuanians", "M'Changan" = "M'Changans", "Macedonian" = "Macedonians", "Malaysian" = "Malaysians", "Markovian" = "Markovians", "Mayan" = "Mayans", "Mbangawian" = "Mbangawians", "Mexican" = "Mexicans", "Modoran" = "Modorans", "Mongolian" = "Mongols", "Mordanian" = "Mordanians", "Morlaidhan" = "Morlaidhans", "Moroccan" = "Moroccans", "Morovian" = "Morovians", "Narobian" = "Narobians", American" = "Native Americans", "Neosian" = "Neosians", Canaanite" = "New Canaanites", Zealander" = "New Zealanders", "Nicaraguan" = "Nicaraguans", Korean" = "North Koreans", "Norwegian" = "Norwegians", Roman" = "Nova Romans", "Oan" = "Oans", "Olympian" = "Olympians", "Pakistani" = "Pakistanis", "Palestinian" = "Palestinians", "Peruvian" = "Peruvians", "Pokolistani" = "Pokols", "Polish" = "Poles", "Polynesian" = "Polynesians", Rican" = "Puerto Ricans", "Pyromanian" = "Pyromanians", "Quraci" = "Quracis", "Rimborian" = "Rimborians", "Roman" = "Romans", "Romanian" = "Romanians", "Romiroan" = "Romiroans", "Russian" = "Russians", "Samoan" = "Samoans", Diabloan" = "San Diabloans", Priscan" = "Santa Priscans", Arabian" = "Saudi Arabians", "Scandinavian" = "Scandinavians", "Scottish" = "Scots", "Skartarian" = "Skartarians", "Sligs" = "Sligs", "Slorenian" = "Slorenians", "Somalian" = "Somalians", African" = "South Africans", Korean" = "South Koreans", "Soviética" = "Soviéticos", "Espanhola" = "Espanhóis", "Swedish" = "Swedes", "Swiss" = "Swiss", "Sudanese" = "Sudanese", "Symkarian" = "Symkarians", "Syrian" = "Syrians", "Taiwanese" = "Taiwanese", "Thai" = "Thais", "Tibetan" = "Tibetans", Verdean" = "Tierra Verdeans", "Trans-Sabalian" = "Trans-Sabalians", "Transbelvan" = "Transbelvans", "Transian" = "Transians", "Transylvanian" = "Transylvanians", "Trojan" = "Trojans", "Tropidoran" = "Tropidorans", "Tynandan" = "Tynandans", "Tundan" = "Tundans", "Tunisian" = "Tunisians", "Turca" = "Turcos", "Ugandan" = "Ugandans", "Ukrainian" = "Ukrainians", Planets Citizen" = "United Planets Citizens", "Venegerian" = "Venegerians", "Venezuelan" = "Venezuelans", "Vietnamese" = "Vietnamese", "Vlatavan" = "Vlatavans", "Wakandan" = "Wakandans", "Welsh" = "Welsh", Lander" = "Wild Landers", "Xibalban" = "Xibalbans", "Yugoslavian" = "Yugoslavs", "Zambesian" = "Zambesians", "Zambian" = "Zambians", "Zandian" = "Zandians", "Zanzibari" ="Zanzibaris", "Zenoshan" = "Zenoshans", } local substitutes = { "abysmia" = "Abysmiana", "afegão" = "Afegã", "áfrica" = "Africana", "africano" = "Africana", "albania" = "Albanian", "américa" = "Americana", "americano" = "Americana", "amérika" = "Amerikana", "amerikano" = "Amerikana", "amazona" = "Amazona", "amazoniana" = "Amazona", "angola" = "Angolana", "angolano" = "Angolana", "apokolips" = "Apokoliptiana", "argentina" = "Argentina", "argentino" = "Argentina", "armenia" = "Armenian", "ásia" = "Asiática", americano" = "Americana", "ásio-americano" = "Americana", americana" = "Americana", "ásio-americana" = "Americana", "asgard" = "Asgardiana", "atlântida" = "Atlante", "attilan" = "Attilan", "austanburg" = "Austanburger", "austrailia" = "Australian", "austria" = "Austrian", "azania" = "Azanian", civilization" = "Aztek", "grã-bretanha" = "Britânica", "brits" = "Britânica", britain" = "British", "balkan" = "Balkan", "belrusia" = "Belarusian", "bialyan" = "bialyan", "belgium" = "Belgian", "borgonia" = "Borgonian", "bosnia" = "Bosnian", and herzgovina" = "Bosnian", "brazil" = "Brazilian", "cambodia" = "Cambodian", "canaan" = "Canaanite", "canada" = "Canadian", "carib" = "Carib", "caribbean" = "Carib", "china" = "Chinese", "colombia" = "Colombian", "congo" = "Congolese", republic of the congo" = "Congolese", of the congo" = "Congolese", "cooperative" = "Cooperative", verde" = "Costa Verdean", "croatoa" = "Croatoan", "cuba" = "Cuban", "czechoslovakia" = "Czechoslovakian", "danish" = "Danish", "delanza" = "Delanzan", "denmark" = "Danish", "delvadia" = "Delvadian", dominican republic" = "Dominican", republic" = "Dominican", "egypt" = "Egyptian", "england" = "English", "eternos" = "Eterna", "eterno" = "Eterna", "europa" = "Européia", "europeu" = "Européia", "ethopia" = "Ethiopian", "feithera" = "Feitheran", "feitheran" = "Feitheran", "finnish" = "Finnish", "finland" = "Finnish", "french" = "French", "france" = "French", unido" = "Britânica", "brit" = "Britânica", "britânico" = "Britânica", bretanha" = "Britânica", "gamorra" = "Gamorran", "gardevia" = "Gardevian", genesis" = "Genisisian", "georgia" = "Georgian", (asia)" = "Georgian", "alemanha" = "Alemã", "alemão" = "Alemã", "ghana" = "Ghanaian", "ghudaza" = "Ghudazan", gorila" = "Cidadão da Cidade Gorila", "grécia" = "Grega", "guatemala" = "Guatemalan", "haiti" = "Haitian", "hasaragua" = "Hasaraguan", "hawaii" = "Hawaiian", "hell" = "Hellion", "holland" = "Dutch", "hungria" = "Húngara", "húngaro" = "Húngara", empire" = "Huns", "iceland" = "Icelandic", "ilandia" = "Ilandian", "india" = "Indian", "indonesia" = "Indonesian", "irã" = "Iraniana", "iraq" = "Iraqi", "ireland" = "Irish", "israel" = "Israeli", "italy" = "Italian", "jamaica" = "Jamaican", "japan" = "Japanese", "jarhanpur" = "Jarhanpurian", "kahndaq" = "Kahndaqi", "karlovna" = "Karlovnan", "korans" = "Koran", "kandor" = "Kandorian", "kaznia" = "Kaznian", "korea" = "Korean", "kenyan" = "Kenyan", "kenyans" = "Kenyan", "kenya" = "Kenyan", of israel" = "Israelite", "kravia" = "Kravian", "laos" = "Laotian", "latkovia" = "Latkovian", (amalgam universe)" = "Latkovian", "latveria" = "Latverian", "libya" = "Libyan", "lithuania" = "Lithuanian", "m'changa" = "M'Changan", "macedonia" = "Macedonian", "malaysian" = "Malaysian", "markovia" = "Markovian", "markovians" = "Markovian", civilization" = "Mayan", "mbanangawi" = "Mbangawian", "mexico" = "Mexican", "mexicans" = "Mexican", "modorans" = "Modoran", "modora" = "Modoran", "morlaidh" = "Morlaidhan", "mongolia" = "Mongolian", "mongolians" = "Mongolian", "monk" = "Monk", "mordania" = "Mordanian", "morocco" = "Moroccan", "moroccans" = "Moroccan", "morovia" = "Morovian", "morovians" = "Morovian", american" = "Native American", "native" = "Native American", "neos" = "Neosian", "norweigan" = "Norwegian", "norwegians" = "Norwegian", "narobia" = "Narobian", zealand" = "New Zealander", "dutch" = "Dutch", "netherlands" = "Dutch", "nicaragua" = "Nicaraguan", korea" = "North Korean", "oa" = "Oan", "olympus" = "Olympian", "olympia" = "Olympian", "pakistan" = "Pakistani", "peru" = "Peruvian", "philippines" = "Filipino", philippines" = "Filipino", "pokolistan" = "Pokolistani", "poland" = "Polish", "polynesia" = "Polynesian", rica" = "Puerto Rican", "pyromania" = "Pyromanian", "pyroman" = "Pyromanian", "qurac" = "Quraci", "rimbor" = "Rimborian", "romania" = "Romanian", "rome" = "Roman", "romiro" = "Romiroan", "russia" = "Russian", prisca" = "Santa Priscan", "samoa" = "Samoan", arabia" = "Saudi Arabian", "scandinavia" = "Scandinavian", "scotland" = "Scottish", "skartaris" = "Skartarian", "slorenia" = "Slorenian", "somalia" = "Somalian", africa" = "South African", korea" = "South Korean", union" = "Soviet", "espanha" = "Espanhola", "espanhol" = "Espanhola", "sudan" = "Sudanese", "sweden" = "Swedish", "switzerland" = "Swiss", "symkaria" = "Symkarian", "syria" = "Syrian", "themyscira" = "Amazon", "themyscurian" = "Amazon", "themyscurians" = "Amazon", "tynanda" = "Tynandan", soviet union" = "Soviet", "taiwan" = "Taiwanese", "thailand" = "Thai", "tibet" = "Tibetan", verde" = "Tierra Verdean", "trans-sabal" = "Trans-Sabalian", "transbelvia" = "Transbelvan", "transia" = "Transian", "transylvania" = "Transylvanian", "tritonis" = "Tritonian", "troy" = "Trojan", "tropidor" = "Tropidoran", "tundi" = "Tundan", "tunisia" = "Tunisian", "turquia" = "Turca", "turco" = "Turca", "uganda" = "Ugandan", "eua" = "Americana", "eu" = "Americana", unidos" = "Americana", "e.u.a." = "Americana", unidos da américa" = "Americana", planets" = "United Planets Citizen", kingdom" = "British", "ukraine" = "Ukrainian", das repúblicas socialistas soviéticas" = "Soviética", soviética" = "Soviética", "soviético" = "Soviética", "urss" = "Soviética", "u.r.s.s." = "Soviética", "venezuela" = "Venezuelan", "venegaria" = "Venegarian", "vietnam" = "Vietnamese", "vlatava" = "Vlatavan", "wales" = "Welsh", lands" = "Wild Lander", "xanthua" = "Xanthuan", "xibalba" = "Xibalban", "yugoslavia" = "Yugoslavian", "zambesi" = "Zambesian", "zambia" = "Zambian", "zandia" = "Zandian", "zanzibar" = "Zanzibari", "zenosha" = "Zenoshan", } cidadania_table = { "valid" = valid, "substitutes" = substitutes } ---------------------------- -- Libraries of functions -- ---------------------------- -- stands for High Frequency local HF = require('Module:ComicsHF') -- Parses invocation parameters, trims whitespace, and removes blanks. local getArgs = require('Dev:Arguments').getArgs -- Gives the name of the current page. It's expensive, so we only do it once. -- The _G then makes it global, available to all page functions. _G.vars = { Pagename = mw.title.getCurrentTitle().text } ---------------------------------------------------------- -- Public functions (called from a Template or article) -- ---------------------------------------------------------- -- There is no standalone template, so no public functions. -------------------------------------------------------- -- Internal functions (used in this and other Modules -- -------------------------------------------------------- function valid:in_database( name ) if type( self[ name ] ) 'string' then return true else return nil end end function valid:pluralize( name ) if self:in_database ( name ) then return selfname else -- Brute force method of making a singular plural name = name:gsub( 's$', 'es' ) name = name:gsub( 'x$', 'es' ) name = name:gsub( 'z$', 'es' ) name = name:gsub( 'ch$', 'es' ) name = name:gsub( 'sh$', 'es' ) name = name:gsub( 'y$', 'ies' ) name = name:gsub( 'f$', 'ves' ) name = name:gsub( 'fe$', 'ves' ) name = name:gsub( '^s$', '%1s' ) return name end end function valid:link( name ) return HF.CategoryLink( self:pluralize(name), vars.Pagename, name ) end function substitutes:in_list( name ) if type( self[ string.lower( name ) ] ) 'string' then return true else return nil end end function substitutes:sub( name ) if self:in_list( name ) then return self[ string.lower( name ) ] else return nil end end function substitutes:link( name ) return HF.CategoryLink( validname, vars.Pagename, name ) end function cidadania_table._Cidadania( field, vars ) local output = '' local o = {} -- Check for multiple values separated with commas local values = HF.explode( ',', field.Value ) for i, v in ipairs( values ) do v = HF.trim( v ) if valid:in_database( v ) then -- Check if it's a valid value with a plural form. -- If yes - add category links table.insert(o, valid:link( v ) ) elseif substitutes:sub( v ) then -- If it's not valid, check for a direct substitution -- If there's one in the database, use the corrected one table.insert(o, valid:link( substitutes:sub( v ) ) ) elseif string.match( v, '%[%.*%%]' ) then -- If it's already a link, leave it alone. table.insert(o, v) else -- 3. If no substitution is found -- fallback to a common grammar rules -- and add a page to a Category:Needs valid citizenship table.insert( o , valid:link( v ) .. HF.Category( "Cidadania válida necessária", vars.Pagename ) ) end end -- If Value2 or ValueRef is provided -- concatenate them to the output if not HF.isempty( field.Value2 ) then output = output .. " " .. field.Value2 end if not HF.isempty( field.ValueRef ) then output = output .. " " .. field.ValueRef end return table.concat(o, ' · ') .. output end ------------------------------------------------- -- Output (send it back to whatever called it) -- ------------------------------------------------- return citizenship_table